package com.jkt.rms.business.base;

import java.lang.Comparable;
import java.io.Serializable;


/**
 * This is an object that contains data related to the clientRole table.
 * Do not modify this class because it will be overwritten if the configuration file
 * related to this class is modified.
 *
 * @hibernate.class
 *  table="clientRole"
 */

public abstract class BaseClientRole  implements Comparable<Object>, Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public static String REF = "ClientRole";
	public static String PROP_STATUS = "status";
	public static String PROP_ROLE_CODE = "roleCode";
	public static String PROP_CLIENT_ROLE_NAME = "clientRoleName";
	public static String PROP_UPDATED_DATE = "updatedDate";
	public static String PROP_CLIENT_ROLE_DESCRIPTION = "clientRoleDescription";
	public static String PROP_ID = "id";
	public static String PROP_UPDATED_BY = "updatedBy";


	// constructors
	public BaseClientRole () {
		initialize();
	}

	/**
	 * Constructor for primary key
	 */
	public BaseClientRole (int id) {
		this.setId(id);
		initialize();
	}

	/**
	 * Constructor for required fields
	 */
	public BaseClientRole (
		int id,
		java.lang.String clientRoleName,
		char status) {

		this.setId(id);
		this.setClientRoleName(clientRoleName);
		this.setStatus(status);
		initialize();
	}

	protected void initialize () {}



	private int hashCode = Integer.MIN_VALUE;

	// primary key
	private int id;

	// fields
	private java.lang.String roleCode;
	private java.lang.String clientRoleName;
	private java.lang.String clientRoleDescription;
	private java.lang.String updatedBy;
	private java.util.Date updatedDate;
	private char status;

	// collections
	private java.util.Set<com.jkt.rms.business.Resource> clientRole;



	/**
	 * Return the unique identifier of this class
     * @hibernate.id
     *  generator-class="native"
     *  column="clientRole_id"
     */
	public int getId () {
		return id;
	}

	/**
	 * Set the unique identifier of this class
	 * @param id the new ID
	 */
	public void setId (int id) {
		this.id = id;
		this.hashCode = Integer.MIN_VALUE;
	}




	/**
	 * Return the value associated with the column: role_code
	 */
	public java.lang.String getRoleCode () {
		return roleCode;
	}

	/**
	 * Set the value related to the column: role_code
	 * @param roleCode the role_code value
	 */
	public void setRoleCode (java.lang.String roleCode) {
		this.roleCode = roleCode;
	}



	/**
	 * Return the value associated with the column: role_name
	 */
	public java.lang.String getClientRoleName () {
		return clientRoleName;
	}

	/**
	 * Set the value related to the column: role_name
	 * @param clientRoleName the role_name value
	 */
	public void setClientRoleName (java.lang.String clientRoleName) {
		this.clientRoleName = clientRoleName;
	}



	/**
	 * Return the value associated with the column: role_description
	 */
	public java.lang.String getClientRoleDescription () {
		return clientRoleDescription;
	}

	/**
	 * Set the value related to the column: role_description
	 * @param clientRoleDescription the role_description value
	 */
	public void setClientRoleDescription (java.lang.String clientRoleDescription) {
		this.clientRoleDescription = clientRoleDescription;
	}



	/**
	 * Return the value associated with the column: updated_by
	 */
	public java.lang.String getUpdatedBy () {
		return updatedBy;
	}

	/**
	 * Set the value related to the column: updated_by
	 * @param updatedBy the updated_by value
	 */
	public void setUpdatedBy (java.lang.String updatedBy) {
		this.updatedBy = updatedBy;
	}



	/**
	 * Return the value associated with the column: updated_date
	 */
	public java.util.Date getUpdatedDate () {
		return updatedDate;
	}

	/**
	 * Set the value related to the column: updated_date
	 * @param updatedDate the updated_date value
	 */
	public void setUpdatedDate (java.util.Date updatedDate) {
		this.updatedDate = updatedDate;
	}



	/**
	 * Return the value associated with the column: status
	 */
	public char getStatus () {
		return status;
	}

	/**
	 * Set the value related to the column: status
	 * @param status the status value
	 */
	public void setStatus (char status) {
		this.status = status;
	}



	/**
	 * Return the value associated with the column: ClientRole
	 */
	public java.util.Set<com.jkt.rms.business.Resource> getClientRole () {
		return clientRole;
	}

	/**
	 * Set the value related to the column: ClientRole
	 * @param clientRole the ClientRole value
	 */
	public void setClientRole (java.util.Set<com.jkt.rms.business.Resource> clientRole) {
		this.clientRole = clientRole;
	}

	public void addToClientRole (com.jkt.rms.business.Resource resource) {
		if (null == getClientRole()) setClientRole(new java.util.TreeSet<com.jkt.rms.business.Resource>());
		getClientRole().add(resource);
	}





	public boolean equals (Object obj) {
		if (null == obj) return false;
		if (!(obj instanceof com.jkt.rms.business.ClientRole)) return false;
		else {
			com.jkt.rms.business.ClientRole clientRole = (com.jkt.rms.business.ClientRole) obj;
			return (this.getId() == clientRole.getId());
		}
	}

	public int hashCode () {
		if (Integer.MIN_VALUE == this.hashCode) {
			return (int) this.getId();
		}
		return this.hashCode;
	}

	public int compareTo (Object obj) {
		if (obj.hashCode() > hashCode()) return 1;
		else if (obj.hashCode() < hashCode()) return -1;
		else return 0;
	}

	public String toString () {
		return super.toString();
	}


}